---
title: Retrieve addresses
summary: Loads a policy's mailing, claim, location, third-party-manager, or policyholder address, with claim-to-mailing fallback and demo-user data masking.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-09-01
library: SAIF.Business.View.Policy
reference_type: embedded
operation_id: op-06-retrieve-addresses
trigger: Caller invokes GetPolicyAddress or GetPolicyClaimAddress
---

# Retrieve addresses

Loads an address for a policy — mailing, claim, location-sequence-number, third-party-manager, or policyholder — masking contact details for demo users.

| Field | Value |
| --- | --- |
| **Operation ID** | op-06-retrieve-addresses |
| **Trigger** | Caller invokes `clsPolicyAddress.GetPolicyAddress` / `GetPolicyClaimAddress` / `GetPolicyAddressByLocationSeqNum` / `GetTpManagerAddress` / `GetPolicyHolderAddress` (or the pass-through statics on `clsPolicyData`) |
| **Inputs** | Policy number (or location sequence number), address/contact type, `GetMailAddrFlag`, user access level |
| **Outputs** | Populated `clsPolicyAddress` |
| **Primary components** | `clsPolicyAddress.GetPolicyAddress` family, `BeforeRetrieve`/`AfterRetrieve`, `Fill` |
| **Entry point** | `SAIF.Business.View.Policy/clsPolicyAddress.vb` |

## Steps

1. Caller invokes one of the five shared `Get*Address` factory methods, each of which constructs a `Criteria` with a specific address/contact-type combination (e.g. `CLAIMADDRESSTYPE`, `THIRDPARTYMANAGERTYPE`, `POLICYHOLDERADDRESSTYPE`/`POLICYHOLDERCONTACTTYPE`) and delegates to `inDataPortalInfo.DataAccessLayer.RetrieveObject`.
2. Framework invokes `BeforeRetrieve`: if `MyCriteria.AddressType = ADDRESSLOCATIONSEQNUM` (the location-sequence-number path), assigns `MyCriteria.RetrieveAddressByLocationSeqNum` ([SQL-008](../sql/SQL-008-getpolicyaddressbylocseqnum.md)) and binds only `inLocationSeqNum`; otherwise assigns `MyCriteria.RetrieveSQL` ([SQL-007](../sql/SQL-007-getpolicyaddress.md), procedure `pk72846_view_policy.getpolicyaddress`) and binds `inPolicyNum`, `inAddressType`, `inContactType`, and `inGetMailAddrWhenNotFound` — the "claim-to-mailing fallback" flag.
3. Framework executes the request against Oracle.
4. Framework invokes `AfterRetrieve`: casts the result to `clsSAIFDataReader`, calls `Reader.Read()`, and if a row was returned calls `Fill(Reader)`; explicitly closes the reader if still open; then `MarkOld()`.
5. `Fill` branches on `IsDemoUser`: for a normal user it hydrates ~15 fields (address lines, city/state/county/country, zip+4, phone/fax via `clsPhone`, contact name/phone/email, `loc_email_addr`) directly from named reader columns, and sets `m_Foreign = True` when `loc_country` is neither `"US"` nor empty. For a demo user, every field is instead populated from `clsConstants.DataMaskingConstants` sentinel values ([BR-VP-010](../business-rules.md#br-vp-010-demo-users-see-masked-data)) — the reader is not read for masked fields.
6. `GetPolicyClaimAddress`'s `inGetMailAddrFlag` (`YesNoFlag`) is passed through to the stored procedure as `inGetMailAddrWhenNotFound`, meaning the claim-vs-mailing fallback decision is made in the database procedure, not in this class.*
7. An officer-of-notice lookup ([SQL-009](../sql/SQL-009-officer-of-notice-lookup.md)) is exposed through this class's affiliate-lookup surface but was not directly located as a distinct method in this pass — cross-referenced from the hub catalog and [BUSINESS_AFFILIATE](../database-tables.md#business_affiliate)/[AFFILIATE](../database-tables.md#affiliate) table usage only.**

## Process flow

```mermaid
flowchart TD
	Start(["Caller invokes a<br>Get*Address factory method"]) --> A["Construct Criteria with<br>address/contact type"]
	A --> B{AddressType =<br>ADDRESSLOCATIONSEQNUM?}
	B -->|Yes| C["BeforeRetrieve assigns<br>RetrieveAddressByLocationSeqNum"]
	B -->|No| D["BeforeRetrieve assigns<br>RetrieveSQL, binds policy num,<br>address/contact type, mail flag"]
	C --> E["Framework executes<br>against Oracle"]
	D --> E
	E --> F["AfterRetrieve reads<br>first row via reader"]
	F --> G{IsDemoUser?}
	G -->|No| H["Fill hydrates real<br>address/contact fields"]
	G -->|Yes| I["Fill substitutes<br>DataMaskingConstants values"]
	H --> End(["Return populated<br>clsPolicyAddress"])
	I --> End
```

## Failure and edge-case behavior
- No row returned: `Fill` is never invoked and the address object is returned unpopulated (`m_Valid` not set to `True`) — callers must check validity themselves.*
- Demo-user masking happens entirely client-side in `Fill` after the real row is (or is not) read — the query itself does not change for demo users, only how the result is interpreted.*
- `m_Foreign` is only set `True`, never explicitly reset `False`, so its default (`False`) is relied upon for domestic addresses.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

## Sources
- `SAIF.Business.View.Policy/clsPolicyAddress.vb`
- `SAIF.Business.View.Policy/clsPolicyData.vb`
